import { Module } from '@nestjs/common';
import * as TelegramBot from 'node-telegram-bot-api';
import { RedisModule } from 'src/redis/redis.module';
import { config } from '../../config';
import { TelegramBotCommandService } from './telegram-bot-command.service';
import { TelegramBotController } from './telegram-bot.controller';
import { TelegramBotService } from './telegram-bot.service';

@Module({
	imports: [RedisModule],
	controllers: [TelegramBotController],
	providers: [
		{
			provide: 'TelegramBot',
			useFactory: () => {
				return new TelegramBot(config.bot.token, { polling: true });
			},
		},
		TelegramBotService,
		TelegramBotCommandService,
	],
})
export class TelegramBotModule {}
